package com.frogs.ucenter.service.daoimpl;

import java.util.HashMap;
import java.util.Map;

import com.frogs.framework.base.dao.BaseDao;
import com.frogs.framework.base.service.daoimpl.BaseServiceImpl;
import com.frogs.ucenter.dao.UserIntegralMoneyRelationDao;
import com.frogs.ucenter.entity.UserIntegralMoneyRelation;
import com.frogs.ucenter.service.UserIntegralMoneyRelationService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class) 
@Service("userIntegralMoneyRelationService")
public class UserIntegralMoneyRelationServiceImpl extends BaseServiceImpl<UserIntegralMoneyRelation> implements UserIntegralMoneyRelationService {
    @Autowired
    private UserIntegralMoneyRelationDao userIntegralMoneyRelationDao;

    public UserIntegralMoneyRelationServiceImpl() {
        super();
    }

    public UserIntegralMoneyRelationDao getUserIntegralMoneyRelationDao() {
        return userIntegralMoneyRelationDao;
    }

    /**
     * Don't remove or edit it.
     */
    @Override
    protected BaseDao<UserIntegralMoneyRelation> getBaseDao() {
        return userIntegralMoneyRelationDao;
    }

    public void setUserIntegralMoneyRelationDao(UserIntegralMoneyRelationDao userIntegralMoneyRelationDao) {
        this.userIntegralMoneyRelationDao = userIntegralMoneyRelationDao;
    }

	@Override
	public boolean isExistsUserIntegralMoneyRelation(int levelId) {
		Map<String, Object> params = new HashMap<String,Object>();
		params.put("eqLevelId", levelId);
		if(userIntegralMoneyRelationDao.selectCountByMap(params) > 0) {
			return true;
		};
		return false;
	}
}